<!-- @author Hussein Abo El Seoud -->

<div class ="row-fluid">
    <div class="span4 well"> 
        <h1>Tweets</h1>
    </div>
    <div class="span4 well"> 
        <h1>Mentions</h1>
        <table>
            <?php
            $posts = (array) $mentions;
            foreach ($posts as $post1): $post = (array) $post1;
                $user1 = $post['user'];
                $user = (array) $user1;
                ?>
                <tr style="background-color:#bce8f1"><td>
                        <?php
                        echo $this->Html->image($user['profile_image_url']) . ' ' . $this->Html->link($user['screen_name'], array('action' => 'view', $post['id_str'])) . ' ' .
                        $this->Html->link($post['text'], array('action' => 'view', $post['id_str'])) . "<br />" .
                        $post['created_at'] . "<br />" .
                        $this->Html->image('https://si0.twimg.com/images/dev/cms/intents/icons/reply_hover.png') .
                        $this->Html->link('reply', "javascript:SetReply('@" . $user['screen_name'] . "','" . $post['id_str'] . "')") . ' ' . $this->Html->image('https://si0.twimg.com/images/dev/cms/intents/icons/retweet_hover.png');
                        if ($post['retweeted'] == '0') {
                            echo $this->Html->link('retweet', array('controller' => 'Tweets', 'action' => 'retweetPermission', $post['id_str'], 0), NULL, 'Are you sure you want to retweet this post ?') . ' ';
                        } else {
                            echo $this->Html->link('undo retweet', array('controller' => 'Tweets', 'action' => 'undoRetweet', $post['id_str']), NULL) . ' ';
                        }
                        echo $this->Html->image('https://si0.twimg.com/images/dev/cms/intents/icons/favorite_hover.png');
                        if ($post['favorited'] == '0') {
                            echo $this->Html->link('favorite', array('controller' => 'Tweets', 'action' => 'favorite', $post['id_str'], '0')) . ' ';
                        } else {
                            echo $this->Html->link('unfavorite', array('controller' => 'Tweets', 'action' => 'unfavorite', $post['id_str'], 0)) . ' ';
                        }
                        echo $this->Html->link('assign', array('controller' => 'Tasks', 'action' => 'addTask', $post['id_str'])) . "<br/>" . $this->Html->link('view conversation', array('action' => 'view', $post['id_str']));
                        ?>

                    </td></tr>
            <?php endforeach; ?>
        </table>
    </div>
    <div class="span4 well">
        <h1>Direct messages</h1>
    </div>
</div>
